{#if error} @{data.username}'s profile could not be loaded. {:else}
{#if userData === null} Could not load user profile for @{data.username}.

Does this user exist? {:else if userData === undefined} {:else}

{#if userData} {/if}

@{userData.name} {#if userData && authorisedUsers.includes(userData.id)} ‌ {/if} Badge Wall

{$locale({ values: { username: data.username, anime: (userData.statistics.anime.minutesWatched / 60 / 24).toFixed(1), manga: estimatedDayReading(userData.statistics.manga.chaptersRead).toFixed(1) } }).user.profile.statistics}

{#await fetch(root(`/api/badges?id=${userData.id}`))} {displayBadges(userData.name, '...')} {:then badges} {#await badges.json()} {displayBadges(userData.name, '...')} {:then badges} {displayBadges(userData.name, badges.length)} {:catch} {displayBadges(userData.name, '?')} {/await} {:catch} {displayBadges(userData.name, '?')} {/await}

{/if}
{#if userData && userData.id === $identity.id} {#await fetch(root(`/api/preferences?id=${userData.id}`)) then rawPreferences} {#await rawPreferences.json() then preferences}

{$locale().user.preferences.title} { if (userData) fetch(root(`/api/preferences?id=${userData.id}&toggleHideMissingBadges`), { method: 'PUT' }); }} checked={preferences.hide_missing_badges} /> {$locale().user.preferences.hideMissingBadges.title} {$locale().user.preferences.hideMissingBadges.hint}
{/await} {/await} {/if} {/if}